/**
 * @file ngtcpserver.h
 * @author Suk Robert Koh (srkoh87z@gmail.com)
 *
 * @brief Type of server which uses TCP connection to communicate
 */

#ifndef NGTCPSERVER_H_
#define NGTCPSERVER_H_

#include "ngserver.h"

/**
 * @class	NGTcpServer	Type of server which uses TCP connection to communicate
 */
class NGTcpServer : public NGServer
{
public:
	NGTcpServer(int port, int _maxUser);
	virtual ~NGTcpServer();

	BOOL process();

protected:
	BOOL setUpNetwork(int port);
	void tearDownNetwork();

#ifndef WIN32
	static void *networkThread(void *arg);
#endif

	BOOL acceptUser();
	BOOL handleRecv(int arrayPosition);
	BOOL handleSend(int arrayPosition);
};

#endif /* NGTCPSERVER_H_ */
